package org.tong.jpa.entities;

import io.swagger.models.auth.In;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.io.Serializable;

/**
 * @author
 * @date 2022-08-01 15:23
 */
@Entity
@Table(name = "tb_student")
@Data
@ToString
@AllArgsConstructor
@NoArgsConstructor
@DynamicInsert(value = true)
@DynamicUpdate(value = true)
public class Student implements Serializable {

    @Id
    private Long id;

    @Column(length = 30)
    private String name;

    //@Version
    @Column
    private Integer version;

    @Column
    private Integer age;

    public Student(Long id, String name, Integer version) {
        this.id = id;
        this.name = name;
        this.version = version;
    }
}
